package de.sendorian.app.forumArchive.repository;

import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Component;

import de.sendorian.app.forumArchive.domain.User;


@Component("userRepository")
public class UserRepositoryImpl extends RepositoryBase<User> implements UserRepository {

    public UserRepositoryImpl() {
        super(User.class);
    }


    /* (non-Javadoc)
     * @see de.sendorian.app.forumArchive.repository.IUserRepository#findByName(java.lang.String)
     */
    public User findByName(String name) {
        try {
            return findByUniqueAttribute("name", name);
        } catch (EmptyResultDataAccessException e) {
            logger.debug("No User found with name " + name);
        }
        return null;
    }
}
